﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApp1
{
    class TwoDimensionalArray
    {
        public void TwoDimensional()
        {
            double[,] grade = { { 85, 86, 84 }, { 52, 63.5, 47 }, { 54, 59, 54 } };
            for (int i = 0; i < grade.GetLength(0); i++)
            {
                Console.WriteLine("第{0}个学生的成绩", i + 1);
                for (int j = 0; j < grade.GetLength(0); j++)
                {
                    if (j == 0)
                    {
                        Console.WriteLine("语文成绩是：{0}", grade[i, j]);
                    }
                    if (j == 1)
                    {
                        Console.WriteLine("数学成绩是：{0}", grade[i, j]);
                    }
                    if (j == 2)
                    {
                        Console.WriteLine("英语成绩是：{0}", grade[i, j]);
                    }

                }
            }



            int[][] arrays = new int[3][];
            arrays[0] = new int[] { 1, 2 };
            arrays[1] = new int[] { 3, 4, 5 };
            arrays[2] = new int[] { 6, 7, 8, 9 };
            for (int i = 0; i < arrays.Length; i++)
            {
                Console.WriteLine("输出数组中第{0}行的元素：",i+1);
                for (int j = 0; j < arrays[i].Length; j++)
                {
                    Console.Write(arrays[i][j] + " ");
                }
                Console.WriteLine();
            }
        }

    }
}
